package com.woniuxy.service.impl;

import com.woniuxy.api.RemoteProductService;
import com.woniuxy.entity.ProductDTO;
import com.woniuxy.entity.utils.ResponseEntity;
import com.woniuxy.service.OrderServiceByProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceByProductImpl implements OrderServiceByProduct {
    @Autowired
    RemoteProductService remoteProductService;

    @Override
    public ResponseEntity findProductList(String name, double minPrice, double maxPrice) {
        // 第一种
//        return remoteProductService.findAllByNameOrPrice(name,minPrice,maxPrice);

        // 第二种
//        Map map = new HashMap<>();
//        map.put("name",name);
//        map.put("minPrice",minPrice);
//        map.put("maxPrice",maxPrice);
//        return remoteProductService.findAllByNameOrPrice(map);

        // 第三种
        return remoteProductService.findAllByNameOrPrice(new ProductDTO(name,minPrice,maxPrice));
    }
}
